blob: c9c6c2b1cb61caa6db5e029d6bce1c76a6c075a7 [file] [log] [blame]
Junio C Hamanoff979792007-11-16 10:11:301// Please don't remove this comment as asciidoc behaves badly when
2// the first non-empty line is ifdef/ifndef. The symptom is that
3// without this comment the <git-diff-core> attribute conditionally
4// defined below ends up being defined unconditionally.
5// Last checked with asciidoc 7.0.2.
6
7ifndef::git-format-patch[]
8ifndef::git-diff[]
Junio C Hamano00b8b632007-12-07 09:50:499ifndef::git-log[]
Junio C Hamanoff979792007-11-16 10:11:3010:git-diff-core: 1
Junio C Hamano00b8b632007-12-07 09:50:4911endif::git-log[]
Junio C Hamanoff979792007-11-16 10:11:3012endif::git-diff[]
13endif::git-format-patch[]
14
15ifdef::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:2316-p::
Junio C Hamano3b70d3c2009-11-21 17:37:3717--no-stat::
18Generate plain patches without any diffstats.
Junio C Hamanoff979792007-11-16 10:11:3019endif::git-format-patch[]
20
21ifndef::git-format-patch[]
22-p::
Junio C Hamanobbbb8652008-12-29 10:34:2223-u::
Junio C Hamanoff979792007-11-16 10:11:3024Generate patch (see section on generating patches).
25{git-diff? This is the default.}
26endif::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:2327
Junio C Hamano69361562007-07-26 02:14:3428-U<n>::
Junio C Hamano69361562007-07-26 02:14:3429--unified=<n>::
30Generate diffs with <n> lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:3731the usual three.
32ifndef::git-format-patch[]
33Implies `-p`.
34endif::git-format-patch[]
Junio C Hamano69361562007-07-26 02:14:3435
Junio C Hamano3b70d3c2009-11-21 17:37:3736ifndef::git-format-patch[]
Junio C Hamano9ae1a062006-07-10 08:12:3437--raw::
38Generate the raw format.
Junio C Hamanoff979792007-11-16 10:11:3039{git-diff-core? This is the default.}
Junio C Hamano3b70d3c2009-11-21 17:37:3740endif::git-format-patch[]
Junio C Hamano9ae1a062006-07-10 08:12:3441
Junio C Hamano3b70d3c2009-11-21 17:37:3742ifndef::git-format-patch[]
Junio C Hamano54559c82006-04-13 07:45:1243--patch-with-raw::
Junio C Hamano3b70d3c2009-11-21 17:37:3744Synonym for `-p --raw`.
45endif::git-format-patch[]
Junio C Hamano54559c82006-04-13 07:45:1246
Junio C Hamano20d47e32009-01-26 06:36:0247--patience::
Junio C Hamano22bcc112009-01-24 08:05:1848Generate a diff using the "patience diff" algorithm.
49
Junio C Hamano4a9a76a2006-10-01 05:40:2950--stat[=width[,name-width]]::
51Generate a diffstat. You can override the default
Junio C Hamano3b70d3c2009-11-21 17:37:3752output width for 80-column terminal by `--stat=width`.
Junio C Hamano4a9a76a2006-10-01 05:40:2953The width of the filename part can be controlled by
54giving another width to it separated by a comma.
Junio C Hamanoba7c8d82006-04-15 06:17:4255
Junio C Hamanofbe00522006-10-19 05:58:4856--numstat::
Junio C Hamano3b70d3c2009-11-21 17:37:3757Similar to `\--stat`, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:4858deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:4359abbreviation, to make it more machine friendly. For
60binary files, outputs two `-` instead of saying
61`0 0`.
Junio C Hamanofbe00522006-10-19 05:58:4862
Junio C Hamano7d23f5e2006-12-16 07:44:0463--shortstat::
Junio C Hamano3b70d3c2009-11-21 17:37:3764Output only the last line of the `--stat` format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:0465number of modified files, as well as number of added and deleted
66lines.
67
Junio C Hamano6a45be92008-04-22 08:19:0368--dirstat[=limit]::
Junio C Hamanoa2f46622008-09-03 05:20:3169Output the distribution of relative amount of changes (number of lines added or
70removed) for each sub-directory. Directories with changes below
71a cut-off percent (3% by default) are not shown. The cut-off percent
Junio C Hamano3b70d3c2009-11-21 17:37:3772can be set with `--dirstat=limit`. Changes in a child directory is not
73counted for the parent directory, unless `--cumulative` is used.
Junio C Hamano6a45be92008-04-22 08:19:0374
Junio C Hamanoa476efa2008-10-10 15:31:4275--dirstat-by-file[=limit]::
Junio C Hamano3b70d3c2009-11-21 17:37:3776Same as `--dirstat`, but counts changed files instead of lines.
Junio C Hamanoa476efa2008-10-10 15:31:4277
Junio C Hamano6959c6c2006-05-17 10:34:1178--summary::
79Output a condensed summary of extended header information
80such as creations, renames and mode changes.
81
Junio C Hamano3b70d3c2009-11-21 17:37:3782ifndef::git-format-patch[]
Junio C Hamanod1308c92006-04-16 11:01:0983--patch-with-stat::
Junio C Hamano3b70d3c2009-11-21 17:37:3784Synonym for `-p --stat`.
85endif::git-format-patch[]
Junio C Hamanod1308c92006-04-16 11:01:0986
Junio C Hamano3b70d3c2009-11-21 17:37:3787ifndef::git-format-patch[]
Junio C Hamano5706e0b2009-11-24 10:54:1688
Junio C Hamano1a4e8412005-12-27 08:17:2389-z::
Junio C Hamano5706e0b2009-11-24 10:54:1690ifdef::git-log[]
91Separate the commits with NULs instead of with new newlines.
92+
93Also, when `--raw` or `--numstat` has been given, do not munge
94pathnames and use NULs as output field terminators.
95endif::git-log[]
96ifndef::git-log[]
Junio C Hamano0c053e82010-04-19 06:46:3497When `--raw`, `--numstat`, `--name-only` or `--name-status` has been
98given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano5706e0b2009-11-24 10:54:1699endif::git-log[]
100+
101Without this option, each pathname output will have TAB, LF, double quotes,
102and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
103respectively, and the pathname will be enclosed in double quotes if
104any of those replacements occurred.
Junio C Hamano1a4e8412005-12-27 08:17:23105
106--name-only::
107Show only names of changed files.
108
109--name-status::
Junio C Hamanoa9aee782008-04-23 16:09:20110Show only names and status of changed files. See the description
111of the `--diff-filter` option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:23112
Junio C Hamanoc21ab052009-10-31 04:03:55113--submodule[=<format>]::
114Chose the output format for submodule differences. <format> can be one of
115'short' and 'log'. 'short' just shows pairs of commit names, this format
116is used when this option is not given. 'log' is the default value for this
117option and lists the commits in that commit range like the 'summary'
118option of linkgit:git-submodule[1] does.
119
Junio C Hamano4aa0bcc2010-03-03 05:13:12120--color[=<when>]::
Junio C Hamano9ae1a062006-07-10 08:12:34121Show colored diff.
Junio C Hamano4aa0bcc2010-03-03 05:13:12122The value must be always (the default), never, or auto.
Junio C Hamano9ae1a062006-07-10 08:12:34123
124--no-color::
125Turn off colored diff, even when the configuration file
126gives the default to color output.
Junio C Hamano4aa0bcc2010-03-03 05:13:12127Same as `--color=never`.
Junio C Hamano9ae1a062006-07-10 08:12:34128
Junio C Hamano20d47e32009-01-26 06:36:02129--color-words[=<regex>]::
130Show colored word diff, i.e., color words which have changed.
131By default, words are separated by whitespace.
132+
133When a <regex> is specified, every non-overlapping match of the
134<regex> is considered a word. Anything between these matches is
135considered whitespace and ignored(!) for the purposes of finding
136differences. You may want to append `|[^[:space:]]` to your regular
137expression to make sure that it matches all non-whitespace characters.
138A match that contains a newline is silently truncated(!) at the
139newline.
140+
141The regex can also be set via a diff driver or configuration option, see
142linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly
143overrides any diff driver or configuration setting. Diff drivers
144override configuration settings.
Junio C Hamano3b70d3c2009-11-21 17:37:37145endif::git-format-patch[]
Junio C Hamano85e45fa2006-08-13 07:47:41146
Junio C Hamano9ae1a062006-07-10 08:12:34147--no-renames::
148Turn off rename detection, even when the configuration
149file gives the default to do so.
150
Junio C Hamano3b70d3c2009-11-21 17:37:37151ifndef::git-format-patch[]
Junio C Hamanoa890c4f2007-01-28 10:29:21152--check::
153Warn if changes introduce trailing whitespace
Junio C Hamano3dac5042007-12-15 08:40:54154or an indent that uses a space before a tab. Exits with
155non-zero status if problems are found. Not compatible with
156--exit-code.
Junio C Hamano3b70d3c2009-11-21 17:37:37157endif::git-format-patch[]
Junio C Hamanoa890c4f2007-01-28 10:29:21158
Junio C Hamano1a4e8412005-12-27 08:17:23159--full-index::
Junio C Hamano5cf43ca2008-08-20 09:14:14160Instead of the first handful of characters, show the full
161pre- and post-image blob object names on the "index"
162line when generating patch format output.
Junio C Hamano9ae1a062006-07-10 08:12:34163
164--binary::
Junio C Hamano3b70d3c2009-11-21 17:37:37165In addition to `--full-index`, output a binary diff that
166can be applied with `git-apply`.
Junio C Hamano1a4e8412005-12-27 08:17:23167
168--abbrev[=<n>]::
169Instead of showing the full 40-byte hexadecimal object
170name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56171lines, show only a partial prefix. This is
Junio C Hamano3b70d3c2009-11-21 17:37:37172independent of the `--full-index` option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:23173the diff-patch output format. Non default number of
Junio C Hamano3b70d3c2009-11-21 17:37:37174digits can be specified with `--abbrev=<n>`.
Junio C Hamano1a4e8412005-12-27 08:17:23175
176-B::
177Break complete rewrite changes into pairs of delete and create.
178
179-M::
180Detect renames.
181
182-C::
Junio C Hamano16f98872007-06-12 16:09:14183Detect copies as well as renames. See also `--find-copies-harder`.
Junio C Hamano1a4e8412005-12-27 08:17:23184
Junio C Hamano3b70d3c2009-11-21 17:37:37185ifndef::git-format-patch[]
Junio C Hamano6ec31b92006-02-10 05:52:01186--diff-filter=[ACDMRTUXB*]::
187Select only files that are Added (`A`), Copied (`C`),
188Deleted (`D`), Modified (`M`), Renamed (`R`), have their
Junio C Hamanoa2deec52008-10-18 18:58:09189type (i.e. regular file, symlink, submodule, ...) changed (`T`),
190are Unmerged (`U`), are
Junio C Hamano6ec31b92006-02-10 05:52:01191Unknown (`X`), or have had their pairing Broken (`B`).
192Any combination of the filter characters may be used.
193When `*` (All-or-none) is added to the combination, all
194paths are selected if there is any file that matches
195other criteria in the comparison; if there is no file
196that matches other criteria, nothing is selected.
Junio C Hamano3b70d3c2009-11-21 17:37:37197endif::git-format-patch[]
Junio C Hamano6ec31b92006-02-10 05:52:01198
Junio C Hamano1a4e8412005-12-27 08:17:23199--find-copies-harder::
Junio C Hamano16f98872007-06-12 16:09:14200For performance reasons, by default, `-C` option finds copies only
Junio C Hamanoa77a5132007-06-08 16:13:44201if the original file of the copy was modified in the same
Junio C Hamano1a4e8412005-12-27 08:17:23202changeset. This flag makes the command
203inspect unmodified files as candidates for the source of
204copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14205projects, so use it with caution. Giving more than one
206`-C` option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:23207
208-l<num>::
Junio C Hamano3b70d3c2009-11-21 17:37:37209The `-M` and `-C` options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:23210is the number of potential rename/copy targets. This
211option prevents rename/copy detection from running if
212the number of rename/copy targets exceeds the specified
213number.
214
Junio C Hamano3b70d3c2009-11-21 17:37:37215ifndef::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:23216-S<string>::
Junio C Hamano5217a272009-03-21 00:39:33217Look for differences that introduce or remove an instance of
218<string>. Note that this is different than the string simply
219appearing in diff output; see the 'pickaxe' entry in
220linkgit:gitdiffcore[7] for more details.
Junio C Hamano1a4e8412005-12-27 08:17:23221
222--pickaxe-all::
Junio C Hamano3b70d3c2009-11-21 17:37:37223When `-S` finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:23224changeset, not just the files that contain the change
225in <string>.
226
Junio C Hamanobfe9e752006-04-05 21:43:28227--pickaxe-regex::
228Make the <string> not a plain string but an extended POSIX
229regex to match.
Junio C Hamano3b70d3c2009-11-21 17:37:37230endif::git-format-patch[]
Junio C Hamanobfe9e752006-04-05 21:43:28231
Junio C Hamano1a4e8412005-12-27 08:17:23232-O<orderfile>::
233Output the patch in the order specified in the
234<orderfile>, which has one shell glob pattern per line.
235
Junio C Hamano3b70d3c2009-11-21 17:37:37236ifndef::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:23237-R::
238Swap two inputs; that is, show differences from index or
239on-disk file to tree contents.
240
Junio C Hamano24bc09a2008-02-28 00:27:44241--relative[=<path>]::
242When run from a subdirectory of the project, it can be
243told to exclude changes outside the directory and show
244pathnames relative to it with this option. When you are
245not in a subdirectory (e.g. in a bare repository), you
246can name which subdirectory to make the output relative
247to by giving a <path> as an argument.
Junio C Hamano3b70d3c2009-11-21 17:37:37248endif::git-format-patch[]
Junio C Hamano24bc09a2008-02-28 00:27:44249
Junio C Hamanobbbb8652008-12-29 10:34:22250-a::
Junio C Hamanoc26f5482006-07-09 09:38:14251--text::
252Treat all files as text.
253
Junio C Hamanofd468962007-02-14 23:45:04254--ignore-space-at-eol::
Junio C Hamano3a702342007-12-12 21:34:02255Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:04256
Junio C Hamanobbbb8652008-12-29 10:34:22257-b::
Junio C Hamanod9c2d2f2006-12-06 08:59:07258--ignore-space-change::
Junio C Hamano3a702342007-12-12 21:34:02259Ignore changes in amount of whitespace. This ignores whitespace
260at line end, and considers all other sequences of one or
261more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:07262
Junio C Hamanobbbb8652008-12-29 10:34:22263-w::
Junio C Hamanod9c2d2f2006-12-06 08:59:07264--ignore-all-space::
Junio C Hamano3a702342007-12-12 21:34:02265Ignore whitespace when comparing lines. This ignores
266differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:07267line has none.
268
Junio C Hamano1d40ee82009-01-07 10:14:16269--inter-hunk-context=<lines>::
270Show the context between diff hunks, up to the specified number
271of lines, thereby fusing hunks that are close to each other.
272
Junio C Hamano3b70d3c2009-11-21 17:37:37273ifndef::git-format-patch[]
Junio C Hamano48fd2f62007-03-19 02:02:30274--exit-code::
275Make the program exit with codes similar to diff(1).
276That is, it exits with 1 if there were differences and
2770 means no differences.
278
Junio C Hamano35e57552007-03-25 07:54:35279--quiet::
Junio C Hamano3b70d3c2009-11-21 17:37:37280Disable all output of the program. Implies `--exit-code`.
281endif::git-format-patch[]
Junio C Hamano35e57552007-03-25 07:54:35282
Junio C Hamanobb0f4042007-07-04 06:41:40283--ext-diff::
284Allow an external diff helper to be executed. If you set an
Junio C Hamano35738e82008-01-07 07:55:46285external diff driver with linkgit:gitattributes[5], you need
286to use this option with linkgit:git-log[1] and friends.
Junio C Hamanobb0f4042007-07-04 06:41:40287
288--no-ext-diff::
289Disallow external diff drivers.
290
Junio C Hamanodfccbb02008-05-26 01:16:14291--ignore-submodules::
292Ignore changes to submodules in the diff generation.
293
Junio C Hamanoe27cbd22007-12-21 17:57:33294--src-prefix=<prefix>::
295Show the given source prefix instead of "a/".
296
297--dst-prefix=<prefix>::
298Show the given destination prefix instead of "b/".
299
300--no-prefix::
301Do not show any source or destination prefix.
302
Junio C Hamano1a4e8412005-12-27 08:17:23303For more detailed explanation on these common options, see also
Junio C Hamanofce7c7e2008-07-02 03:06:38304linkgit:gitdiffcore[7].